
define(function(){  
	var CARD_PATTERN = [ "♠", "♥", "♣","♦" ],
	CARD_NAME=[ "3", "4", "5", "6", "7", "8", "9", "0", "J", "Q", "K", "A", "2", "王", "王" ];
	function getCardName(cardId) {
		return CARD_PATTERN[parseInt(cardId%4)] + CARD_NAME[parseInt(cardId/4)];
	}
	function getValue(cardId) {
		return parseInt(cardId/4);
	}
	var id_w=52,id_k=57;
	
	var nameArr = [
	               [-7000,"穷神"],
	               [-6000,"丐帮帮主"],
	               [-5000,"丐帮大长老"],
	               [-4000,"丐帮弟子"],
	               [-3000,"逃命中"],
	               [-2000,"奴隶"],
	               [-1000,"穷鬼"],
	               [0,"包身工"],
	               [1000,"短工"],
	               [2000,"长工"],
	               [3000,"佃户"],
	               [4000,"贫农"],
	               [5000,"渔夫"],
	               [6000,"猎人"],
	               [7000,"中农"],
	               [8000,"富农"],
	               [9000,"掌柜"],
	               [10000,"衙役"],
	               [11000,"衙役"],
	               [12000,"小财主"],
	               [13000,"大财主"],
	               [14000,"小地主"],
	               [15000,"大地主"],
	               [16000,"知县"],
	               [17000,"通判"],
	               [18000,"知府"],
	               [19000,"总督"],
	               [20000,"巡抚"],
	               [21000,"丞相"],
	               [22000,"皇帝"],
	               [23000,"斗王"],
	               [24000,"斗仙"],
	               [25000,"斗尊"]
	             
	               ];
	
	var anmiPosArr={
	                "my":[0,0],
	                "right":[0,0],
	                "left":[0,0]
				};
	
	var talkArr = [
	               ["快点快点，朋友，我等到花儿都谢咯！","朋友，一寸光阴一寸金啊！","赶紧吧，我手上的炸弹赶着用呢！"],
	               ["长得帅，牌就是这么好！","我又要赢了，看来我的运气很旺啊！","哎，这么烂的牌也能赢啊！"],
	               ["我快要被炸晕了>_<，救命！","我又犯晕了，怎么能出这么臭的牌呢？","行行好，给我留几块钱坐车回家吧！"],
	               ["不怕神一样的对手，只怕猪一样的队友丫！","和你合作，实在快哉快哉！"," Go On！让我们再接再厉，干趴了他！"],
	               ["战斗力只有5的小兵，我和你不是一个级别的！","不服SOLO，等你来战！","我还有5个炸弹没用呢！"]
	               ];
	
	var peopleInfo = [
	                  ["星座：双鱼<br>身高：158cm<br>三围：85 60 86<br>爱好：吃零食，玩电玩<br>介绍：天生娃娃脸<br>技能：在boss战中有25%的几率触发“对子技能”",[15,10]],
	                  ["星座：处女<br>身高：162<br>三围：87 61 88<br>爱好：喜欢侍候主人，泡咖啡<br>介绍：处理家中一切事务<br>技能：在boss战中有25%的机率触发“顺子”技能",[20,15]],
	                  ["星座：双子<br>身高：170cm<br>三围：91 65 94<br>爱好：斗你妹的超级粉丝<br>介绍：来自法国的大胸美女<br>技能：在boss战中有25%的机率触发“三条”技能",[25,20]],
	                  ["星座：摩羯<br>身高：173cm<br>三围：93 66 94<br>爱好：看书，喝酒<br>介绍：高傲，固执<br>技能：在boss战中有25%机率触发“飞机”技能",[30,25]]
	                  ];
	
	var awardsArr = []
	
	
	return {
		CARD_ID_WANG:id_w,/** 小王 */
		CARD_ID_KING:id_k,/** 大王 */		
		CARD_VALUE_WANG:parseInt(id_w/4),/** 小王 */
		CARD_VALUE_KING:parseInt(id_k/4),/** 大王 */
		CARD_VALUE_A:11  ,/** A的牌面值 */
		CARD_VALUE_2:12,/** 2的牌面值 */
		
		
		
		getCard:function(id){
			return {
				cardId:id,
				cardName:getCardName(id),
				value:getValue(id)
			}
		},
		
		getName:function(code){
			var code = parseInt(code);
			for(var i=0; i<nameArr.length; i++){
				if(code<nameArr[i][0]){
					return nameArr[i-1][1];
				}
			}
			return nameArr[nameArr.length-1][1];
		},
		
		getAnmiPos:function(obj){
			return anmiPosArr[obj];
		},
		
		getTalkInfo:function(i){
			return talkArr[i][Math.floor(Math.random()*3)];
		},
		
		getNumGif:function(num,type){
			var numArr = num.toString().split("");
			var html = [];
			for(var i=0; i<numArr.length; i++){
				html.push("<span class='"+type+"_"+numArr[i]+" "+type+"_num num_icon'></span>");
			}
			return html.join("");
		},
		
		setRoom:function(num){
			var num = parseInt(num);
			var rooms = $("#points .room_style");
			for(var i=0;i<rooms.length; i++){
				var y = function(n){
					/*打开房间信息*/
					if(num>=parseInt(rooms.eq(n).attr("minBeanFun")) && (num<parseInt(rooms.eq(n).attr("maxBeanFun")) || rooms.eq(n).attr("maxBeanFun")=="undefined")){
						rooms.eq(n).attr("src",rooms.eq(n).attr("onSrc"));
					}else{
						rooms.eq(n).attr("src",rooms.eq(n).attr("offSrc"));
					}
				}(i);
			}
			
		},
		
		getPeopleInfo:function(n){
			return peopleInfo[n];
		},
		
		/*打开BOSS 比赛场 乐斗场*/
		isOpenRoom:function(num){
			var room_boss = $("#room_boss").find("span");
			var room_bs = $("#room_bs").find("span");
			var room_ld = $("#room_ld").find("span");
			/*开启BOSS房间*/
			if(num>=3500){
				room_boss.removeClass("icon_lock");
			}else{
				room_boss.addClass("icon_lock");
			}
			/*开启比赛房间*/
			if(num>=20000){
				room_bs.removeClass("icon_lock");
			}else{
				room_bs.addClass("icon_lock");
			}
			/*开启乐豆房间*/
			if(num>=18000){
				room_ld.removeClass("icon_lock");
			}else{
				room_ld.addClass("icon_lock");
			}
		},
		
		getMinRoom:function(num){
			var num = parseInt(num);
			var rooms = $("#points>.btn_room");
			for(var i=0;i<rooms.length; i++){
				var maxbeanfun = parseInt(rooms.eq(i).attr("maxbeanfun"));
				if(!maxbeanfun){
					return rooms.length-1;
				}
				if(num<maxbeanfun){
					return i;
				}
			}
		},
		
		getMinBoss:function(num){
			var num = parseInt(num);
			var rooms = [3500,40000,150000];
			for(var i=0;i<rooms.length; i++){
				var maxbeanfun = rooms[i];
				if(num>maxbeanfun[rooms.length-1]){
					return rooms.length;
				}
				if(num<maxbeanfun){
					return i;
				}
			}
		},
		
		getAwards:function(n){
			return awardsArr[n];
		}
		
		
	}
}); 